﻿<%@ Page Language="vb" AutoEventWireup="false" Codebehind="ImportActivityTmp.aspx.vb" Inherits="PubProject.ImportActivityTmp" %>
<%@ Register TagPrefix="mwc" Namespace="MySoft.WebControls" Assembly="MySoft.WebControls" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
	<HEAD>
		<title>收件人导入</title>
		<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
		<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
		<meta content="JavaScript" name="vs_defaultClientScript">
		<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
		<script language="javascript" src="/_controls/settings.aspx"></script>
		<link rel="stylesheet" type="text/css" href="/_forms/styles/form.css">
		<LINK href="/_common/styles/dialogs.css" type="text/css" rel="stylesheet">
		<LINK href="/_common/styles/global.css" type="text/css" rel="stylesheet">
		<LINK href="/_grid/map_grid.css" type="text/css" rel="stylesheet">
		<script language="javascript" src="/_controls/util/util.js"></script>
		<script language="javascript" src="/_forms/FormBase.js"></script>
		<script language="javascript" src="/_grid/rep_grid.js"></script>		
		<style>
			.scrollColThead {
			position: relative; 
			top: expression(this.parentElement.parentElement.parentElement.scrollTop);
			z-index:2;
			}
			NOBR{ OVERFLOW: hidden; WIDTH: 100%; TEXT-OVERFLOW: ellipsis }
		</style>
		<script language="javascript">
			function window.onload()
			{
				if (document.all["_Reflesh"].value == "1")			//如果是回调时，
				{
					if (document.all["ErrorInfo"].value != undefined && document.all["ErrorInfo"].value != "")
					{
						alert(document.all["ErrorInfo"].value);
						return;
					}
					else
					{
						if (document.all["ErrorCount"].value == "0")
						{
							alert("成功导入 " + document.all["RightCount"].value + " 条收件人数据！");
							parent.window.returnValue = "success";
							parent.window.close();
						}
						else
						{
							alert("成功导入 " + document.all["RightCount"].value + " 条收件人数据，失败 " + document.all["ErrorCount"].value +" 条！");
							parent.window.returnValue = "success";
						}
					}
				}				
			}
			function okClick()
			{
				//前端校验，不通过则不允许导入
				if (!ClientValidChk())
				{
					return;
				}				
				document.all("ok").click();
				showWaitting();
				document.all["btnOK"].disabled = true;
			}
			function ClientValidChk()
			{
				// 导入 Excel 文件不允许为空
				if (crmForm.fImport.value == "")
				{
					alert("请选择要导入的文件（Excel）！");
					return false;
				}
				
				// 校验是否合法的 Excel 文件
				var sFileName = crmForm.fImport.value.toUpperCase();
				if((sFileName.lastIndexOf(".XLS") + 4) != sFileName.length || sFileName.length < 5)
				{
					alert("请选择Excel类型的文件！");
					return false;
				}
				return true;
			}
			//显示等待页面
			function showWaitting()
			{
				if ( document.all["Waiting"] )
				{
					document.all["Waiting"].style.display = "";
					document.all["Waiting"].style.left=(document.body.clientWidth-200)/2;
					document.all["Waiting"].style.top=(document.body.clientHeight-47)/2;
				}
			}
		</script>
	</HEAD>
	<body MS_POSITIONING="GridLayout" style="PADDING-RIGHT:10px;PADDING-LEFT:10px;PADDING-BOTTOM:10px;PADDING-TOP:10px">
		<form class="map" id="crmForm" method="post" runat="server">
			<asp:textbox id="_Reflesh" style="DISPLAY: none" Runat="server">0</asp:textbox>
			<asp:textbox id="ErrorInfo" style="DISPLAY: none" Runat="server"></asp:textbox>
			<asp:textbox id="RightCount" style="DISPLAY: none" Runat="server">0</asp:textbox>
			<asp:textbox id="ErrorCount" style="DISPLAY: none" Runat="server">0</asp:textbox>
			<asp:button id="ok" style="DISPLAY:none" runat="server" Text="导入"></asp:button>
			
			<table height="100%" cellSpacing="0" cellPadding="0" width="100%">
			<colgroup>
				<col width="60">
				<col width="390">
				<col width="70">
			</colgroup>
			<tr height="25px">
				<td  colspan="3">
					<font color="red">请注意，导入数据将删除收件人列表内容！</font>
				</td>
			</tr>
			<TR height="30" valign="center">
				<TD class="req">导入文件</TD>
				<TD ><INPUT id="fImport" type="file" name="fImport" runat="server" req="1"></TD>
				<TD align="right">&nbsp;<BUTTON style="WIDTH: 70px" onclick="okClick();" id="btnOK" name="btnOK" type="button">导 入</BUTTON></TD>
			</TR>
			<tr>
				<td colspan="3" valign="top">
					<mwc:repeater id="Repeater1" runat="server" SortSignASC='<img src="/_imgs/ico_arrow_u.gif">' SortSignDESC='<img src="/_imgs/ico_arrow_d.gif">' EnablePager="false">
						<HEADERTEMPLATE>
							<TABLE height="100%" id="MainTale" cellSpacing="0" cellPadding="0" width="100%" style="table-layout:fixed;BACKGROUND-COLOR: white;">
								<TBODY>
									<TR vAlign="top" height="22">
										<TD>
											<DIV style="OVERFLOW: auto;  WIDTH: 100%;  HEIGHT: 100%">
												<TABLE id="gridBar" cellSpacing="0"
													cellPadding="0" border="0" gridID="Repeater1" MultiSelect="false" width="100%" style="table-layout:fixed;">
													<COLGROUP id="gridBarCols">
														<COL width="40">
														<COL width="2">
														<COL width="220">
														<COL width="2">
														<COL width="600">
														<COL width="2">
													</COLGROUP>
													<TBODY>
														<TR id="trHeader" class="scrollColThead"  align="center" height="23" pagesize="15">
															<TD class="gridBar" align="center">序号</TD>
															<TD class="gridBar"><IMG src="/_imgs/bar_line.gif"></TD>
															<TD class="gridBar"><NOBR>客户名称</NOBR></TD>
															<TD class="gridBar"><IMG src="/_imgs/bar_line.gif"></TD>
															<TD class="gridBar">错误信息</TD>
															<TD class="gridBar"><IMG src="/_imgs/bar_line.gif"></TD>
														</TR>
						</HEADERTEMPLATE>
						<ITEMTEMPLATE>
							<TR height=24 >
								<TD align="center" colSpan="2"><%# DataBinder.Eval(Container.DataItem, "rowid") %></TD>
								<TD colSpan="2" id="RoomCode" title='<%# DataBinder.Eval(Container.DataItem, "SendName") %>' ><nobr><%# DataBinder.Eval(Container.DataItem, "SendName") %></nobr></TD>
								<TD colSpan="2" id="ErrorInfo" align="left" title='<%# DataBinder.Eval(Container.DataItem, "ErrorInfo") %>'><nobr><%# DataBinder.Eval(Container.DataItem, "ErrorInfo") %></nobr></TD>
							</TR>
						</ITEMTEMPLATE>
						<FOOTERTEMPLATE>
					</TBODY>
				</table>
				</DIV></TD></TR></TBODY></TABLE></FOOTERTEMPLATE> 
				</mwc:repeater>
				</td>
			</tr>
			</table>
			<div id="Waiting" style="BORDER-RIGHT: #9e9e9b 1px solid; BORDER-TOP: #9e9e9b 1px solid; DISPLAY: none; FONT-WEIGHT: bold; FONT-SIZE: 14px; Z-INDEX: 108; BORDER-LEFT: #9e9e9b 1px solid; WIDTH: 223px; COLOR: #ff5a00; LINE-HEIGHT: normal; PADDING-TOP: 16px; BORDER-BOTTOM: #9e9e9b 1px solid; FONT-STYLE: normal; POSITION: absolute; HEIGHT: 47px; BACKGROUND-COLOR: white; TEXT-ALIGN: center; FONT-VARIANT: normal ;">处理中，请稍候...</div>
		</form>
	</body>
</HTML>